<?php
import('mydb.class.php');
class BaseModel{
	var $db = NULL;
	
	function __construct(){
		$this->db = MyDB::getInstance();
	}
	
	public function getMyDB(){
		if(!isset($this->db)){
			dumpError('未初始化数据库连接对象');
		}
		return $this->db;
	}
	
	public static function createTable(){
		dumpError('未实现的重装数据库函数！');
	}
	
	public static function dropTable(){
		dumpError('未实现的删除表的函数！');
	}
	
	protected  static function dropTableByName($name){
		$db = MyDB::getInstance();
		$drop_table = "DROP TABLE IF EXISTS $name ";
		$db->exec($drop_table);
	}
	
	
}